package espacokidsadm.modelo.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import espacokidsadm.modelo.type.Cor;

@Entity
@Table(name="TURMA")
public class Turma implements Serializable {

	private static final long serialVersionUID = 8133207041763015649L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="ID_TURMA")
	private Integer id;
	
	@Column(name="id_cor")
	@Enumerated(EnumType.STRING)
	private Cor cor;
	
	@Column(name="NOME_TURMA")
	private String nomeTurma;

	public Integer getId() {
		return id;
	}

	public Cor getCor() {
		return cor;
	}

	public String getNomeTurma() {
		return nomeTurma;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public void setCor(Cor cor) {
		this.cor = cor;
	}

	public void setNomeTurma(String nomeTurma) {
		this.nomeTurma = nomeTurma;
	}

	
	public String getDescricao(){
		return getNomeTurma() + " - " + getCor().getDescricao();
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Turma other = (Turma) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
	
	 
}
